<?php /* Create Lesson Controller */
	require_once('modules/lessons/actions/create-custom/scripts/validate-lesson.php');
	if (isset($_POST['form-action'])) {
		$validacion = validarClase();
		if (!empty($validacion)) { //fallo validacion
			$arr_students = $lesson->getStudents();
			require_once('modules/lessons/actions/create-custom/view/create-lesson.php');
		} else { //si valido correcto
			$last_id = $lesson->insert('clases');
			//$lesson->addlessonToTeacher($last_id,1);
			//$lesson->sendEmail();
			$lesson->addStudentsToLesson($_POST['students'],$last_id);
			require_once('modules/lessons/actions/list/index.php');
		}
	} else {
		$arr_students = $lesson->getStudents();
		require_once('modules/lessons/actions/create-custom/view/create-lesson.php');
	}
?>